<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of DBConfig
 *
 * @author bonfiglio
 */
class DBConfig {

    private static $databaseServers = array();
    private static $loaded = false;

    static function getConfig() {
        if (!self::$loaded) {
            self::loadConfig();
            self::$loaded = true;
        }
        // returning database connection settings
        return array(
            'databaseServers' => self::$databaseServers
        );
    }

    static function setConfig($database, $server, $user, $pass) {
        self::$databaseServers[$database] = array(
            'server' => $server,
            'user' => $user,
            'pass' => $pass
        );
    }

    static function loadConfig() {
        $default = array(
            'front' => array(
                'server' => 'localhost',
                'user' => 'root',
                'pass' => 'certificats'
            ),
            'extranet' => array(
                'server' => 'localhost',
                'user' => 'root',
                'pass' => 'certificats'
            ),
            '4d' => array(
                'server' => 'localhost',
                'user' => 'root',
                'pass' => 'certificats'
            ),
//            'certinerform' => array(
//                'server' => 'mysql51-7.business',
//                'user' => 'certinerform',
//                'pass' => 'frantz1972'
//            ),
//            'wanahamsql' => array(
//                'server' => 'mysql51-39.perso',
//                'user' => 'wanahamsql',
//                'pass' => 'ncLQzeYG'
//            ),
//            'crm' => array(
//                'server' => 'localhost',
//                'user' => 'root',
//                'pass' => 'certificats'
//            ),
            'log' => array(
                'server' => 'localhost',
                'user' => 'root',
                'pass' => 'certificats'
            )
        );
        self::$databaseServers = array_merge($default,self::$databaseServers);
    }

}

?>
